module.exports = {
    // 开发日志
    log: (...args)=>{
    let len = args.length;
    let title = len > 1 ? args[0] : '开发调试';
    let obj = args[len - 1];
    console.group(`%c${title}`, 'font-size:12px;color:#24D864;border-radius:2px;background:#000;padding:2px 4px');
    console.log(obj);
    console.groupEnd();
}
,
/**
 *  避免多次点击
 *
 *  @param {String} deftype 类型
 *  @param {Number} timer 间隔毫秒数
 *
 *  示例：if(tool.subTwice('checkOrder')){console.log('重复点击');return;}
 *
 **/
subTwice: (type = 'def', timer = 8000) =>{
    var subTwice = wx.getStorageSync('subTwice') || {};
    var d = new Date();
    var oldTime = 0;
    var newTime = d.getTime();
    var flag = true; // 非第一次点击

    if (subTwice[type]) {
        oldTime = subTwice[type];
    } else {
        oldTime = 0;
    }
    oldTime += timer;
    subTwice[type] = d.getTime();
    if (newTime > oldTime) {
        wx.setStorageSync('subTwice', subTwice);
        flag = false;
    }

    return flag;
}
,
// 请求
request:function () {
    console.log(request);
}
}
